<!DOCTYPE html>
<html>

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title></title>
</head>

<body>
  
  <div id="main"></div>
  
  <script>
    /*
      拆分文本节点使用的是splitText(text_index)于normalize()作用相反,
      返回新产生的节点
    */
    const main = document.getElementById('main')
    const textNode = document.createTextNode('hello world')
    
    main.appendChild(textNode)
    console.log(main.childNodes.length) // 1
    
    const newTextNode = main.firstChild.splitText(5)
    
    console.log(main.childNodes.length)  // 2
  </script>
</body>

</html>
